package com.toulezu.test.freemarker;

import freemarker.template.TemplateMethodModelEx;
import freemarker.template.TemplateModelException;

import java.util.List;

/**
 * 通过实现 TemplateMethodModelEx 接口来自定义方法
 */
public class Subtract implements TemplateMethodModelEx {

	@SuppressWarnings("rawtypes")
	public Object exec(List arguments) throws TemplateModelException {
		return Integer.parseInt(arguments.get(0).toString()) - Integer.parseInt(arguments.get(1).toString());
	}

}
